#!/usr/bin/env python
# Config ini handler
import inireader
import os,sys
from misc import *


CONFIG_INI = "webwallpaper.ini"

InitConfigs = {
"global" : {
"OUTPUT_PATH" : ".\\wallpapers\\",
"IRFANVIEW_FILE" : "C:\\Program Files\\IrfanView\\i_view32.exe",
"SETWALLPAPER_PATH" : ""
}
}

Configs = {}

def parse_configs():
    global Configs
    change_to_program_dir()

    reader = inireader.IniReader(CONFIG_INI, InitConfigs)
    Configs = reader.sections("global")

    Configs["OUTPUT_PATH"] = os.path.abspath(Configs["OUTPUT_PATH"])

    # Makedir is OUTPUT_PATH not exists
    if not os.path.isdir(Configs["OUTPUT_PATH"]):
        os.makedirs(Configs["OUTPUT_PATH"])